package cn_dk;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Auther:dingkai
 * @date:2021/11/30 0030 下午 3:47
 * @Desc:
 */
@WebServlet(urlPatterns = "/CServlet")
public class CServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("去DServlet");

        //向request域对象中 存一个数据
        request.setAttribute("hanbao", "香辣鸡腿堡");
        // 链式编程横
        request.getRequestDispatcher("DServlet").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }
}
